
#include "BallGame.h"

void BallGame::onCleanup(){

	//Textos
	for(unsigned int i=0; i< Texto::textList.size(); i++)
		Texto::textList[i]->onCleanup();

	Texto::textList.clear();

	level.onCleanup();

	for(unsigned int i=0; i< CEntity::entityList.size(); i++)
		if(CEntity::entityList[i])
			CEntity::entityList[i]->onCleanup();

	while(!CEntity::entityEffects.empty())
		CEntity::entityEffects.pop();

	CEntity::entityList.clear();

	//Sons
	for(unsigned int i=0; i< CSound::soundList.size(); i++)
		CSound::soundControl.onCleanup();

	CSound::soundList.clear();

	if(displaySurface)
		SDL_FreeSurface(displaySurface);

	if(testSurface)
		SDL_FreeSurface(testSurface);
	
	Mix_CloseAudio();
	TTF_Quit();
	SDL_Quit();
}